<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>Document</title>
        <style>
            *{
                margin: 0px;
                padding: 0px;
                list-style: none;

            }
            ul{
                overflow: hidden;
            }
            ul li{
                float: left;
                width: 100px;
                height: 30px;
                margin-right: 10px;
                
            }
            ul li:nth-of-type(1){
                background:lime;
            }
            section>div{
                width: 500px;
                height: 200px;
                text-align: center;
                line-height: 200px;
                display: none;
            }
            section>div:nth-of-type(1){
                display: block;
            }
             p{
                width: 100px;
                height: 20px;
            }
        </style>
    </head>
    <body>
        <ul>
            <li style="background: lime;">游戏资料</li>
            <li style="background: none;">内容中心</li>
            <li style="background: none;">赛事中心</li>
            <li style="background: none;">百态王者</li>
            <li style="background: none;">社区互动</li>
        </ul>
        <section>
            <div style="display: block;">
                <p>版本介绍</p>
                <p>游戏介绍</p>
                <p>英雄资料</p>
                <p>爆料站</p>
                <p>故事站</p>
                <p>游戏壁纸</p>
            </div>
            <div style="display: none;">
                <p>攻略中心</p>
                <p>英雄攻略</p>
                <p>视频中心</p>
                <p>王者视角</p>
            </div>
            <div style="display: none;">
                <p>kpl</p>
                <p>全国大赛</p>
                <p>k甲</p>
                <p>赛事数据</p>
            </div>
            <div style="display: none;">
                <p>王者文化站</p>
                <p>王者音乐站</p>
                <p>商户特权</p>
                <p>万千世界</p>
            </div>
            <div style="display: none;">
                <p>微信圈子</p>
                <p>微博圈子</p>
                <p>王者营地</p>
                <p>手Q部落</p>
            </div>
        </section>
        <script>
           
            var tags=document.getElementsByTagName('li');
            var boxs=document.getElementsByTagName('div');
            for(var i=0;i<tags.length;i++){
                
                tags[i].index=i;
                tags[i].onclick=function(){
                   
                    for(var j=0;j<tags.length;j++){
                        tags[j].style.background="none";
                       
                        boxs[j].style.display="none"
                    }
                    this.style.background='lime';
                    var n=this.index;
                    boxs[n].style.display='block'
                }
            }
        </script>
    </body>
</html>